home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-03-06 | 1.5 KB | 48 lines | [TEXT/GEOL] |
- Item 2775304 26-Jan-90 15:44PST
-
- From: DAWSON.M Dawson, Mark
-
- To: MACAPP.TECH$ MacApp Technical
-
- Sub: Writing resource forks
-
- I've got a question regarding adding resources to a file. I used the
- DemoText.p example file as an example, but mine wouldn't work…I got a FFC3
- error (-63/WrPermission error) the first AddResource call I made.
-
- Example code:
- numChars := GetHandleSize(fDocText);
- FailOSErr(FSWrite(aRefNum, numChars, fDocText^));
-
- IF fTEView.fStyleType = kWithStyle THEN
- BEGIN
- fTEView.ExtractStyles(styles, elements);
- FailOSErr(HandToHand(Handle(styles)));
- AddResource(Handle(styles), kTextStyleRsrcType, kStylesRsrcID, '');
- FailResError;
- END;
-
- My code (in C++):
- longdataBytes;
-
- inherited::DoWrite(aRefNum, makingCopy);
- dataBytes = GetHandleSize(fTextHdl);
- FailOSErr(FSWrite(aRefNum, &dataBytes, *fTextHdl));// write data to disk
- Handle aHandle;
- FailOSErr(PtrToHand((Ptr)&"\pHello world",&aHandle,12)); // copy hdr into a
- AddResource(aHandle, 'mtst', 1, (Str255)"\p");
- FailResError();
- DisposIfHandle(aHandle);
-
- Is there something I'm missing? The DemoText example uses a NULL ('') string
- as the file name; I assume tell the Mac OS to use the file that is open?
-
- What's the procedure for writing resource data out when the data's being writen
- out? (It may be some misuse/lack of understanding of C++ && MacApp).
-
-
- Thanks,
-
- Mark
-
-